import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
    {
        path: '/page1',
        component: () => import('/src/views/page1.vue')
    },
    {
        path: '/page2',
        component: () => import('/src/views/page2.vue')
    }
]

const createCustomRouter = () => createRouter({
    history: createWebHashHistory(),
    scrollBehavior: () => ({ y: 0 }),
    routes
})

const router =createCustomRouter();

export function resetRouter() {
    const newRouter = createCustomRouter()
    router.matcher = newRouter.matcher // reset router
}

export default router